package com.qf.dao;

import com.qf.pojo.SysUsers;
import org.apache.ibatis.annotations.Select;

import java.util.Set;

public interface SysUserDao {

    @Select("select * from sys_users where username = #{username}")
    SysUsers selectUserByUsername(String username);

    @Select("select name from sys_role where id in " +
            "        (select r_id from sys_user_role where u_id = #{userId})")
    Set<String> findRolesByUserId(int userId);

    @Select("select perms from sys_menu where id in " +
            "          (select m_id from sys_role_menu where r_id in " +
            "          (select r_id from sys_user_role where u_id = #{userId}))")
    Set<String> findPermsByUserId(int userId);
}
